use proc_macro::TokenStream;
use quote::ToTokens;
use syn::{parse_macro_input, DeriveInput};

#[proc_macro_derive(SynTest)]
pub fn syn_test(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    let input = parse_macro_input!(input as DeriveInput);
    println!("MyIdent:{:?}", input.ident.to_token_stream());
    TokenStream::new()
}

#[proc_macro_derive(Hello)]
pub fn hello_derive(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    let input = parse_macro_input!(input as DeriveInput);
    println!("{:?}", input.ident.to_token_stream());
    let name = input.ident.to_token_stream();

    let expanded = quote::quote! {
        impl #name {
            pub fn hello() {
                println!("Hello, world!");
            }
        }
    };
    expanded.into()
}
